/*
 * 作者：杨红伟
 * 日期：2017.05.10
 */
(function(window){
	"use strict";
	var nuiWeixin = function(){
		this._init();
	};

	var showToast = function(msg, duration, location) {
		var msg = msg ? msg : '错误';
		var duration = duration ? duration : '2000';
		var location = location ? location : 'bootom';
		api.toast({
			msg: msg,
			duration: duration,
			location: location
		});
	}

	nuiWeixin.prototype = {

		//初始化
		_init:function () {
			if(typeof(api) == 'undefined'){
				console.log('该插件必须在APICloud中运行');
			}else{
				this.weixin = api.require('wx');
			}
		},

		//分享网页
		shareWeb : function(Vscene,title,description,thumb,contentUrl){
			var weixin = this.weixin;
			weixin.shareWebpage({
				apiKey : '',
				scene : Vscene,
				title : title,
				thumb : thumb,
				description : description,
				contentUrl : contentUrl
			},function (ret,err) {
				if(ret.status){
					showToast('分享成功！',2,'bottom');
				}
			});
		},

	};

	window.nuiWeixin = nuiWeixin;
})(window);






















